<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>二维码管理系统</title>
</head>
<body>
<%@include file="../common/NavigationLeft.jsp"%>
	<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
		<form id="addAsset_form" class="form-horizontal" method="post" >
			<input id="assetId"  type="hidden" name="asset.id"  value="${id}"/>
			<div class="form-group">
				<label for="equipIdent_input" class="col-sm-2 control-label">资产编号</label>
				<div class="col-sm-3">
					<input type="text" name="asset.equipIdentifier" class="form-control" id="equipIdent_input"
						placeholder="" value="${asset.equipIdentifier}">
				</div>
			</div>
			<div class="form-group">
				<label for="it_code_input" class="col-sm-2 control-label">IT编号</label>
				<div class="col-sm-3">
					<input type="text" name="asset.itCode" class="form-control" id="it_code_input"
						   placeholder="" value="${asset.itCode}">
				</div>
			</div>
			<%--资产状态   使用中、已分配、维修中、备用、报废--%>
			<%--使用地点   无锡、上海、北京、深圳、香港、厦门--%>
			<%--资产类别   笔记本、台式电脑主机、显示器、打印机、无线设备、交换机、移动存储设备、软件、其他配件--%>
			<%--来源   异地调配、采购--%>
			<div class="form-group">
				<label for="equipModel_input" class="col-sm-2 control-label">设备型号</label>
				<div class="col-sm-3">
					<input type="text" name="asset.equipModel" value="${asset.equipModel}" class="form-control" id="equipModel_input"
						placeholder="">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">设备类别</label>
				<div class="col-sm-3">
					<s:select list="#{0:'笔记本',1:'台式电脑主机',2:'显示器',3:'打印机',4:'无线设备',5:'交换机',6:'移动存储设备',7:'软件',8:'其他配件'}" listKey="key" listValue="value" name="asset.equipGenre" />
				</div>
			</div>
			<div class="form-group">
				<label for="asset.status" class="col-sm-2 control-label">使用状况</label>
				<div class="col-sm-3">
					<s:select list="#{0:'使用中',1:'已分配',2:'维修中',3:'备用',4:'报废'}" listKey="key" listValue="value" name="asset.status" />
				</div>
			</div>
			<%--<div class="form-group">--%>
				<%--<label for="usePosition_input" class="col-sm-2 control-label">使用地点</label>--%>
				<%--<div class="col-sm-3">--%>
					<%--<input type="text" name="asset.usePosition" value="${asset.usePosition}" class="form-control" id="usePosition_input"--%>
						   <%--placeholder="">--%>
				<%--</div>--%>
			<%--</div>--%>
			<%--<div class="form-group">--%>
				<%--<label for="useDepart_input" class="col-sm-2 control-label">使用部门</label>--%>
				<%--<div class="col-sm-3">--%>
					<%--<input type="text" name="asset.useDepart" value="${asset.useDepart}" class="form-control" id="useDepart_input"--%>
						<%--placeholder="">--%>
				<%--</div>--%>
			<%--</div>--%>
			<div class="form-group">
				<label for="asset.source" class="col-sm-2 control-label">设备来源</label>
				<div class="col-sm-3">
					<s:select list="#{0:'异地调配',1:'采购'}" listKey="key" listValue="value" name="asset.source" />
				</div>
			</div>
			<div class="form-group">
				<label for="assetAllocation_input" class="col-sm-2 control-label">资产配置</label>
				<div class="col-sm-3">
					<input type="text" name="asset.assetAllocation" value="${asset.assetAllocation}" class="form-control" id="assetAllocation_input"
						placeholder="">
				</div>
			</div>
			<div class="form-group form-inline">
				<label for="buyTime_input" class="col-sm-2 control-label">购买时间</label>
				<div class="col-sm-3">
					<input  type="text" name="asset.buyTime" onFocus="WdatePicker()" value="<s:date name="asset.buyTime " format="yyyy-MM-dd"/>" class="form-control" id="buyTime_input" />
					<img onclick="WdatePicker({el:'buyTime_input'})" src="/js/My97DatePicker/skin/datePicker.gif"
							width="16" height="22" align="absmiddle">
				</div>
			</div>
			<%--<div class="form-group form-inline">--%>
				<%--<label for="useTime_input" class="col-sm-2 control-label">开始使用时间</label>--%>
				<%--<div class="col-sm-3">--%>
					<%--<input  type="text" onFocus="WdatePicker()" name="asset.usedTime" value="<s:date name="asset.usedTime " format="yyyy-MM-dd"/>" class="form-control" id="useTime_input" />--%>
					<%--<img onclick="WdatePicker({el:'useTime_input'})"--%>
						 <%--src="/js/My97DatePicker/skin/datePicker.gif" width="16"--%>
						 <%--height="22" align="absmiddle">--%>
				<%--</div>--%>
			<%--</div>--%>
			<div class="form-group">
				<label for="remark" class="col-sm-2 control-label">备注</label>
				<div class="col-sm-3">
					<input type="text" name="asset.remarks" value="${asset.remarks}" class="form-control" id="remark"
						   placeholder="">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button id="submit_btn" type="submit"  class="btn btn-default">提交</button>
				</div>
			</div>			
		</form>
	</div>
<script type="text/javascript">

//    $("#usePosition_input").kuCity();
$('#addAsset_form').on('valid.form', function(e){

    // or use ajax submit
    $.post("path/to/server", $(this).serialize())
        .done(function(d){
            // some code
        });
});

    $('#addAsset_form').validator({
        fields:{
            "asset.equipIdentifier":"required",
			"asset.itCode":"required",
			"asset.equipModel":"required",
			"asset.usePosition":"required",
			"asset.assetAllocation" : "required",
			"asset.buyTime": "required"
        },
        valid: function(form) {
            var me = this;
            // Before submitting the form, hold form, to prevent duplicate submission.
            me.holdSubmit();
            var url = "";
            if ($("#assetId").val() == '0') {
                $('#addAsset_form').attr("action","addAsset.action");
//                url = "addAsset.action";
            } else {
                $('#addAsset_form').attr("action","modifyAsset.action");
//                url = "modifyAsset.action";
            }
//            $.ajax({
//                url: url,
//                data: $(form).serialize(),
//                type: "POST",
//                success: function(){
//                    // After the form is submitted successfully, release hold.
//                    me.holdSubmit(false);
//                }
//            });

            form.submit();
//            $("#submit_btn").click(function () {
//
//            })
        }
    });


</script>
</body>

</html>